const sessionCache = {
    set(key, value) {
        sessionStorage.setItem(key, value);
    },
    get(key) {
        return sessionStorage.getItem(key);
    },
    setJson(key, jsonValue) {
        this.set(key,JSON.stringify(jsonValue));
    },
    getJson(key) {
        const value = this.get(key);
        if (value !== null) {
            return JSON.parse(value);
        }
    }
};
const localCache = {
    set(key, value) {
        localStorage.setItem(key, value);
    },
    get(key) {
        return localStorage.getItem(key);
    },
    remove(key) {
        localStorage.removeItem(key);
    },
    clearCache() {
        localStorage.clear();
    }
};

export default {
    session: sessionCache,
    local: localCache
}